﻿using TSU.FAMC.ComputerEngineering.Classes.Enums;

namespace TSU.FAMC.ComputerEngineering.Classes.Circuits.Basis
{
    /// <summary>
    /// Fictive gate to fill gaps in the circuit on the stage of building.
    /// Transmits received signal without processing.
    /// </summary>
    public class StubGate : Gate
    {
        // Properties


        // Methods

        /// <summary>
        /// Processes inputs signals and produces a result signal.
        /// </summary>
        /// <returns>Resulting signal. If Value of the signal is BooleanValue.UNDEFINED it means processing failed.</returns>
        public override Signal Process()
        {
            if (InputSignals.Count == 0)
            {
                var result = new Signal {Value = BooleanValue.Undefined};
                return result;
            }

            // transmitting received signal
            return InputSignals[0];
        }

        /// <summary>
        /// Clones stub element.
        /// </summary>
        /// <returns>Cloned stub element.</returns>
        public override object Clone()
        {
            return new StubGate
            {
                Delay = Delay,
                Id = Id,
                Name = Name
            };
        }
    }
}
